home *** CD-ROM | disk | FTP | other *** search
- /*
- dshell v3
-
- 定数定義、型定義等
- */
-
- typedef unsigned char uchar;
- typedef unsigned short ushort;
-
- #undef NULL
- #define NULL ((void *)0)
-
- #define TRUE 1
- #define FALSE 0
-
-
- /* 制御文字列 (内部表現) */
- #define CTRL_CHAR '\x7f' // <DEL>
- #define NORM_CHAR '\x18' // ^X (12/24ドット表示末尾)
- #define CUT_CHAR 'C' // %CUT → DEL C
- #define LARGE_CHAR 'L' // %V%W → DEL L
- #define SMALL_CHAR 'S' // %V%W → DEL S
- #define HR_CHAR 'K' // ━ → DEL K ━
- #define BOX_CHAR 'W' // %box → DEL W
- #define CTRL_IDSTR "\x7f"
- #define CUT_IDSTR "\x7f""C"
- #define LARGE_IDSTR "\x7f""L"
- #define SMALL_IDSTR "\x7f""S"
-
- #define DUMMY_CHAR CTRL_CHAR // '◎'は一旦 DEL DEL に置換した上で
- #define EXEC_CHAR 'X' // 有効なものは DEL X に、それ以外は'◎'に再置換
- #define VEXEC_CHAR 'x' // 実行済み '◎'
- #define TYPE_CHAR '<' // TYPE= → DEL <
- #define NULTYPE_CHAR '\0' // Type= → DEL NUL
-
- #define FONT_CHAR 'F'
- #define EFONT_CHAR 'f'
-
- #define NUM_BIAS ((uchar)0x20) // 数値をテキストに埋め込む際のゲタ
-
-
- /* テキスト色 */
- #define TCOL1 ((24 << 11) + ( 0 << 6) + (31 << 1)) /* default よりも気持ち抑え目 */
- #define TCOL2 ((10 << 11) + (31 << 6) + (10 << 1)) /* 赤 */
- #define TCOL3 ((31 << 11) + (31 << 6) + (31 << 1)) /* default と同色 */
-
-
- /* dexec() 用フラグ (bit) */
- #define DEX_WAIT (1<<0) /* 実行後、確認のクリックを要求する */
- #define DEX_PSCR (1<<1) /* 実行後、画面を描き直す */
- #define DEX_FKON (1<<2) /* 実行の間、ファンクション行を有効にする */
- #define DEX_RETM (1<<3) /* 実行前、「exit で戻る」旨を表示 */
- #define DEX_NCLR (1<<4) /* 実行時、画面を初期化しない */
- #define DEX_NDOUT (1<<4) // 実行前の din() の呼び出しを抑制する (DEX_NCLR に同じ)
- #define DEX_NDIN (1<<5) // 実行後の dout() の呼び出しを抑制する
- #define DEX_SLNT (1<<6) // 裏にコンソールを切って実行する
- #define DEX_GCLS (1<<7) // 画面を65536色モードに初期化のうえ、クリアする
- #define DEX_GMODE (1<<8) // 実行後の画面モードに応じて DSHELL 側の画面モードを切り替える
- #define DEX_SHELL (1<<15) // COMMAND.X を介する
-
- #define HIGH_SPEED 3 /* joystick,keyboard使用時のカーソル移動速度(x3) */
- #define NOMAL_SPEED 1 /* joystick,keyboard使用時のカーソル移動速度(x1) */
-
- #define RW_HALF 12 /* line of realtime scroll window */
- #define RW_FULL 30
-
- #define MAXSCRLIN 30 /* ページスクロール最大行数 */
- #define DEFSCRLIN MAXSCRLIN-2 /* ページスクロール行数default */
-
-
- /*
- カットファイル関係
- */
- #define CUTFILE 0
- #define TITLESYS 1
-
- #define CUT_MAX 256 /* カットファイルの最大数 (≦4096) */
-
- #define BUF_X 128 /* 非圧縮部のビットパターンのMAX */
- #define BUF_Y 16
-
- #define byteCount(x) ((((x) - 1) >> 3) + 1)
- #define lineCount(y) ((((y) - 1) >> 4) + 1)
-
- typedef uchar LINEBUF[BUF_X];
- typedef struct {
- short dx, dy;
- LINEBUF buffer[BUF_Y];
- } TEXTBUF; /* TEXTPUT()用構造体FNTBUFのかわり */
-
- #define cutREVERSE (1<<7)
- #define cutDUP (1<<6)
- #define cutLEFT (1<<5)
- #define cutRIGHT (1<<4)
-
- typedef struct {
- TEXTBUF *ptr; // カットデータ本体へのポインタ
- uchar *fname; // カットファイル名
- short x; // x dot数
- short y; // y dot数
- char type; // 種別 0...CUT, 1...TITLE.SYS, -1...unknown
- uchar flag; // フラグ
- } CUT;
-
- #define POSPMAX 128 /* 128に根拠なし */
- #define EXLEN 256 /* TYPE=~文字列の処理用バッファなどの長さ… */
-
-
- #define printer_init() INIT_PRN(0xFF,0xFF)
-
-
- /*
- X68000の文字セット中の2バイト文字の1文字目かどうかを調べる
- そうなら TRUE、違うなら FALSE を返す(ハズ)
- */
- #define iskanji1(c) ((signed char)(c) < 0\
- && ((uchar)(c) < 0xa0 || (uchar)(c) >= 0xe0 && (uchar)(c) < 0xf6))
- #define iskanji(c) \
- ((uchar)(c) >= 0x81 && (uchar)(c) < 0xa0 || (uchar)(c) >= 0xe0 && (uchar)(c) < 0xf0)
-
-
- #define clr_kbf() KFLUSHIO(-1)
-
- #define tab_on() (BITSNS(0x02) & 0x01)
- #define esc_on() (BITSNS(0x00) & 0x02)
- #define cr_on() (BITSNS(0x03) & 0x20)
- #define enter_on() (BITSNS(0x09) & 0x40)
- #define help_on() (BITSNS(0x0a) & 0x10)
- #define clr_on() (BITSNS(0x07) & 0x80)
- #define del_on() (BITSNS(0x06) & 0x80)
-
- #define SHIFT_KEY (1<<0)
- #define CTRL_KEY (1<<1)
- #define OPT1_KEY (1<<2)
- #define OPT2_KEY (1<<3)
- #define shift_on() (B_SFTSNS() & SHIFT_KEY)
- #define ctrl_on() (B_SFTSNS() & CTRL_KEY)
- #define opt1_on() (B_SFTSNS() & OPT1_KEY)
- #define opt2_on() (B_SFTSNS() & OPT2_KEY)
-
- #define LED_KANA (1<<8)
- #define LED_ROMA (1<<9)
- #define LED_CODEIN (1<<10)
- #define LED_CAPS (1<<11)
- #define LED_INS (1<<12)
- #define LED_ZENKAKU (1<<14)
- #define space_on() (BITSNS(6) & (1<<5))
- #define codein_on() (B_SFTSNS() & LED_CODEIN)
- #define kana_on() (B_SFTSNS() & LED_KANA)
- #define roma_on() (B_SFTSNS() & LED_ROMA)
- #define caps_on() (B_SFTSNS() & LED_CAPS)
- #define ins_on() (B_SFTSNS() & LED_INS)
- #define zenkaku_on() (B_SFTSNS() & LED_ZENKAKU)
- #define xf3_on() (BITSNS(10) & (1<<7))
- #define xf4_on() (BITSNS(11) & (1<<0))
-
- #define CRTCR00 ((ushort *)0xe80000) // CRTC R0
- #define CRTCR01 ((ushort *)0xe80002) // CRTC R1
- #define CRTCR02 ((ushort *)0xe80004) // CRTC R2
- #define CRTCR03 ((ushort *)0xe80006) // CRTC R3
- #define CRTCR20 ((ushort *)0xe80028) // CRTC R20
- #define CRTCR21 ((ushort *)0xe8002a) // CRTC R21
- #define VIDEOR0 ((ushort *)0xe82400) // VIDEOコントローラ R0
- #define VIDEOR1 ((ushort *)0xe82500) // VIDEOコントローラ R1
- #define VIDEOR2 ((ushort *)0xe82600) // VIDEOコントローラ R2
-
- #define strEqu(s1,s2) (strcmp((s1), (s2)) == 0)
- #define strnEqu(s1,s2,n) (strncmp((s1), (s2), (n)) == 0)
- #define striEqu(s1,s2) (strcmpi((s1), (s2)) == 0)
-
- #define cls() B_CLR_AL()
-
- typedef struct shellvar {
- struct shellvar *next;
- uchar name[0]; // '変数名','\0','定義内容','\0'
- } SHELLVAR;
-
-
- /*
- sp を得る
- */
- #define getSp() ({ \
- void *sptr; \
- asm("move.l sp,%0" : "=g"(sptr)); \
- sptr; \
- })
-
- /*
- 上位/下位 16 ビットを取り出す
- */
- #define lowWord(x) ((ushort)(x))
- #define highWord(x) ({ \
- int val = (x); \
- asm( \
- "clr.w %0\n" \
- "swap.w %0\n" \
- : "=d"(val) : "0"(val)); \
- val; \
- })
-
-
- #define FONTMAX (0x7f-0x20+1)
- typedef struct {
- uchar *pat; // パターン本体へのポインタ
- uchar *fname; // ファイル名
- uchar sect; // 開始“区”(0...半角)
- uchar size; // 区単位のサイズ
- } FONT16;
-
- typedef struct fontAdrTable {
- uchar *table[95];
- struct fontAdrTable *prev;
- } FNTADR_TABLE;
-